package com.nantaphop.hovertouchviewexample.slice;

import com.nantaphop.hovertouchview.HoverTouchHelper;
import com.nantaphop.hovertouchviewexample.ResourceTable;
import com.nantaphop.hovertouchviewexample.widget.MyThumbnail;

import ohos.aafwk.ability.AbilitySlice;

import ohos.aafwk.content.Intent;
import ohos.agp.components.StackLayout;

/**
 * MainAbilitySlice extends AbilitySlice
 *
 */
public class MainAbilitySlice extends AbilitySlice {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
    }

    @Override
    public void onActive() {
        super.onActive();

        StackLayout root = (StackLayout) findComponentById(ResourceTable.Id_root);
        MyThumbnail pic1 = (MyThumbnail) findComponentById(ResourceTable.Id_pic1);
        MyThumbnail pic2 = (MyThumbnail) findComponentById(ResourceTable.Id_pic2);
        MyThumbnail pic3 = (MyThumbnail) findComponentById(ResourceTable.Id_pic3);
        MyThumbnail pic4 = (MyThumbnail) findComponentById(ResourceTable.Id_pic4);
        HoverTouchHelper.make(root, pic1);
        HoverTouchHelper.make(root, pic2);
        HoverTouchHelper.make(root, pic3);
        HoverTouchHelper.make(root, pic4);
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }

}